<script>
  jQuery(document).ready(function() {
    jQuery('#news_event_id').change(function(){  
                                // alert(jQuery(this).val());
                                id = jQuery(this).val();
                                
                                if(id != "")
                                {
                                  loading_area('<%= image_tag "loading_ajax.gif" %>', "#related-images", "#related-images");
                                  jQuery.ajax({
                                  url: '<%= url_for({:controller => 'images', :action => 'related_images'}) %>',
                                  data: "eventid="+id,
                                  success: function (data){
                                        jQuery('#related-images').html(data)
                                      }
                                }); 
                                }
                        });
  });
</script>


<%= form_for(@news, :url => {:controller => "editor_news", :action => "save", :id => @news.id}) do |f| %>
   
  <% if @news.errors.any? %>
	  <div class="notification errors closable">
		<h3><%= pluralize(@news.errors.count, "error") %> prohibited this article from being saved:</h3>
		<ul>
			<% @news.errors.full_messages.each do |msg| %>				
				<li><%= msg %></li>
			<% end %>
		</ul>
	<span title="Close" class="closelink"></span></div>      
  <% end %>					
					<fieldset>
						<legend>Details</legend>
						<h4>Please fill in the form.</h4>
						
                                                <%= f.label :event %>
                                                <%= select("news", "event_id", @events, {:include_blank => 'None'}, :size => 4, :style => "width:500px") %>
                                                
						<%= f.label :title %><%= f.text_field :title, :class => "medium" %>
						<p class="validation">
						*required</p>
						
						
						<%= f.label :body %><%= f.text_field :body, :class => "tinymce" %>
						<p class="validation">
						<a style="top:2px;position:relative" id="insert-image-but" href="#modal-window" onclick='openInsertImage("<%= url_for(:action => 'insert_image_box', :id => "1") %>")' class='button gray'>Insert Images</a>
						*required						
						</p>						
						
						<!-- tinyMCE.execInstanceCommand("article_body","mceInsertContent",false,"sdfsdf"); -->
						
					</fieldset>
  
<% end %>
